import threading
import time


# 厨师线程的执行体
def chef():
    for i in range(1, 4):
        print(f"Chef is cooking dish {i}")
        time.sleep(2)  # 模拟烹饪时间


# 服务员线程的执行体
def waiter():
    for i in range(1, 4):
        print(f"Waiter is setting the table for dish {i}")
        time.sleep(1)  # 模拟准备时间


# 创建厨师线程和服务员线程
chef_thread = threading.Thread(target=chef)
waiter_thread = threading.Thread(target=waiter)

# 启动厨师线程和服务员线程
chef_thread.start()
waiter_thread.start()

# 主线程等待厨师线程和服务员线程执行完成
chef_thread.join()
waiter_thread.join()

# print(list(threading.enumerate()))
